﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;
using TSVNAddin.TSVN;

namespace TSVNAddin.Core.Test
{
	[TestFixture]
	public class CreateRepositoryCommandFixture
	{
		[Test]
		public void QueryStatusAlwaysVisibleAndEnabled()
		{
			var cmd = new CreateRepositoryCommand(null, null);

			Assert.AreEqual(CommandStatus.Enabled, cmd.QueryStatus());
		}

		[Test]
		public void Exec()
		{
			var folderBrowserDialog = MockRepository.GenerateMock<FolderBrowserDialogAdapter>();
			folderBrowserDialog.Stub(x => x.ShowDialog()).Return(@"c:\svn\myproject\");

			var tortoiseProcExecutor = MockRepository.GenerateMock<TortoiseProcExecutor>(null, null);
			tortoiseProcExecutor.Expect(x => x.Exec(TortoiseProcCommandType.RepoCreate, @"c:\svn\myproject\"));

			var cmd = new CreateRepositoryCommand(tortoiseProcExecutor, folderBrowserDialog);
			cmd.Execute();

			tortoiseProcExecutor.VerifyAllExpectations();
		}
	}
}
